package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-07-25
 * Time: 13:14
 */
public class Test {

    public static void main(String[] args) {

        Thread t = new Thread(() -> {
            while(true){
                try {
                    System.out.println("我是thread");
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        } );
        t.start();

        while(true){
            try {
                System.out.println("我是main");
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

}
